package com.wobangkj.common.api.crud;

import com.wobangkj.common.model.crud.Tag;
import com.wobangkj.common.service.TagService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/tag")
public class TagController {
    @Autowired
    private TagService TagService;
    @PostMapping(value = "/create")
    public Object create(@RequestBody Tag data) {
        return TagService.create(data);
    }

    @PutMapping(value = "/update")
    public Object update(@RequestBody Tag tag) {

        return TagService.update(tag);
    }

    @GetMapping("/list")
    public List<Map> list(@RequestBody String[] testint) {

        return TagService.list(testint);
    }

    @GetMapping("/findByNameLike")
    public List<Tag> findByNameLike(String tag_name){
        // 一定要加 "%"+参数名+"%"
        return TagService.findByNameLike(tag_name);
    }
}
